<include file="Public:head" />
<script>
    function fastOrder(obj,id){
        $.post("{:U('Ajax/fastOrder')}",{
            id:id
        },function(data){
            if(data>0){
                showTip('系统提示',"请在下完订单后"+data+"分钟后再催单！",'2',1.5);
            }else{
                var url = obj.attr("data-url");
                goUrl(url);
            }
        })
    }
    $(function(){
        var orderUid = "{$Think.session.order}";
        if(orderUid>0){
          
           $("#pMenu").children(".border").eq(0).hide();
           $("#pMenu").children(".border").eq(2).hide();
           $(".left_commentOrder").hide();
        }else{
            var uid = "{$Think.session.userid}";
            if(uid == ''){
                goUrl("{:U('Login/index')}");
            }
        }
    })
</script>

<link href="__APP__/Application/{$Think.MODULE_NAME}/Public/css/home.css" rel="stylesheet" type="text/css" />
<div id="wrap">
    <div id="school">{$type=0|getAreaName}
        <a href="__APP__/?type=clean">[切换位置]</a>
        <span>/</span>
        <em>今日订单</em>
    </div>
    <div id="container" class="clearfix">
        <div class="shadow clearfix" id="pCenter">
            <include file="Public:left" />

            <div id="pContent" class="today_order">
                <p class="ac_title">我的订单</p>
                <empty name="lists">
                    <div id="noinfo">
                        今日您还没有订过餐喔，现在就去
                        <a href="{:U('Area/lists',array('id'=>$sessionAreaId))}" style="color: #5da">订餐</a>
                        ~
                    </div>
                    <else/>
                    <foreach name="lists" item="row">
                        <div class="order_list">
                            <div class="order_simp">
                                <table>
                                    <tr>
                                        <td class="col1">
                                            <p class="sname fl" id="sname_{$row.id}">
                                                <a href="{:U('Area/detail',array('id'=>$row['sid']))}" target="blank">{$row.shop.name}</a></p>
                                            <p class="order_num fl">
                                                （订单号：<span>{$row.ordernum}</span>）</p>
                                        </td>
                                        <td class="col2">
                                            <if condition="$row['shop']['phone'] neq ''">餐厅电话：{$row.shop.phone}</if>
                                        </td>
                                        <td class="col3 last">
                                            <span style="color:#5ad;font-size:12px;">下单日期：{$row.addtime|date="Y-m-d",###}</span>
                                        </td>
                                    </tr>

                                </table>
                                <table style="margin: 8px 0 0">
                                    <tr>
                                        <td class="col1">
                                            <span>原价：{$row.totalMoney}</span>
                                            <span style="margin:0 10px">折扣：{$row['totalMoney']-$row['realMoney']|getOneDot=###}元</span>
                                            <span class="real_pay">应付：{$row.realMoney}元</span>
                                        </td>
                                        <td class="col2">
<!--                                    <if condition="$row.state eq 0">
                                        <a style="text-decoration: underline;color:#666" id="cancel_{$row.id}"data-func="cancelOrder('{$row.id}')" onclick="confirmBox($(this),'您确定要取消当前订单吗？')">取消订单</a>
                                    </if>-->
                                    </td>
                                    <td class="col3 last">
                                    </td>
                                    </tr>
                                </table>

                            </div>
                            <!--end of order_simp-->
                            <div class="order_detail clearfix">
                                <div class="l fl">
                                    <p><b>真实姓名：</b>{$row.truename}</p>
                                    <p><b>您的手机：</b>{$row.phone}<if condition="$row.phone2 neq ''"><b>&nbsp;备用手机：</b>{$row.phone2}</if></p>
                                    <p><b>您的地址：</b>{$row.addr}</p>
                                    <if condition="$row.remark neq ''">
                                    <p><b>备注：</b>{$row.remark}</p>
                                    </if>
                                </div>
                                <ul class="r fr">
                                    <foreach name="row['sub']" item="row2">
                                        <li>
                                            <span class="fl">{$row2.gname}×{$row2.gnum}</span> 
                                            <span class="fr price">{$row2['gprice']*$row2['gnum']|getOneDot=###}元</span> 
                                        </li>
                                    </foreach>
                                    <if condition='$row.sendprice gt 0'>
                                    <li>
                                            <span class="fl">配送费</span> 
                                            <span class="fr price">{$row.sendprice}元</span> 
                                        </li>
                                        </if>
                                     <if condition='$row.bags gt 0'>
                                    <li>
                                            <span class="fl">打包费</span> 
                                            <span class="fr price">{$row.bags}元</span> 
                                        </li>
                                        </if>

                                </ul>
                            </div>

                            <div class="order_proc pos_relative">
                                <div>
                                    <span class="time">{$row.addtime|date="H:i:s",###}</span>
                                    创建订单  
                                </div>
                                <if condition="$row.state eq 1">
                                    <div class="mt10 order_ready">
                                        <span class="time">{$row.checkTime|date="H:i:s",###}</span>
                                        餐厅已确认您的订单内容，预估美食大约{$row.sendtime}分钟为您送达。
                                    </div>
                                </if>
                                <if condition="$row.reasonTime gt 0 && $row.state eq 9">
                                    <div class="mt10 order_cancel">
                                        <span class="time">{$row.reasonTime|date="H:i:s",###}</span>
                                        订单无效。无效原因：{$row.reason}如有疑问请咨询{$config.title}客服热线{$config.hotline}。
                                    </div>
                                </if>
                                <if condition="$row.state eq 5">
                                    <div class="mt10" style="color:#E54920">
                                        <span class="time">{$row.operateTime|date="H:i:s",###}</span>
                                        订单已完成
                                    </div>
                                </if>
                                <if condition="$row.state gt 0">
                                <p class="refresh clearfix"data-url="{:U('Box/comment')}" id="comment_btn">
                                
                                    {$row.id|getCommentState}
                                
                                <if condition="$row.state eq 1">
                                    <a class='white br4 mr10 shadow call' onclick="fastOrder($(this),'{$row.id}');" data-url="{:U('Area/messages',array('id'=>$row['sid'],'mtype'=>$row['id']))}">催单</a>
                                </if>
                                </p>
                                </if>
                            </div>
                        </div>
                    </foreach>
                </empty>
                <div class='page'>{$page}</div>
            </div>
        </div>
    </div>
    <include file="Public:foot" />